package com.top.zk.pandachannel.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.top.zk.pandachannel.R;
import com.top.zk.pandachannel.bean.CultureBean;
import com.top.zk.pandachannel.help.RecyclerViewAdapterHelper;
import java.util.List;

/**
 * Created by Administrator on 2016/12/21.
 */

public class CultureRecyclerviewAdapter extends RecyclerViewAdapterHelper<CultureBean.ListBean> {

    public CultureRecyclerviewAdapter(Context context, List<CultureBean.ListBean> list) {
        super(context, list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateMyViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_recyclerview_culture,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindMyViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof ViewHolder) {
            ViewHolder holder1 = (ViewHolder) holder;
            holder1.textView_culture_video.setText(list.get(position).getVideoLength());
            holder1.textView_culture_title.setText(list.get(position).getTitle());
            holder1.textView_culture_brief.setText(list.get(position).getBrief());
            String imgURL = list.get(position).getImage();

            Glide.with(context).load(imgURL)
                    .into(holder1.imageView_culture_image);
        }
    }

    class ViewHolder extends RecyclerView.ViewHolder{

        private ImageView imageView_culture_image;
        private TextView textView_culture_video;
        private TextView textView_culture_title;
        private TextView textView_culture_brief;

        public ViewHolder(View itemView) {
            super(itemView);
            imageView_culture_image = (ImageView) itemView.findViewById(R.id.imageView_culture_image);
            textView_culture_video = (TextView) itemView.findViewById(R.id.textView_culture_video);
            textView_culture_title = (TextView) itemView.findViewById(R.id.textView_culture_title);
            textView_culture_brief = (TextView) itemView.findViewById(R.id.textView_culture_brief);
        }
    }
}
